package com.njegovanobradovic.components;

import java.util.List;

import javax.inject.Inject;

import org.apache.tapestry5.annotations.Property;

import com.njegovanobradovic.entities.Slide;
import com.njegovanobradovic.so.GetAll;

public class Slideshow {
	@Inject
	private GetAll<Slide> getAllSlides;
	@Property
	private Slide slide;
	
	public List<Slide> getSlideList(){
		try {
			getAllSlides.setSearchForType(Slide.class);
			return getAllSlides.execute();
		} catch (Exception e) {
			return null;
		}
	}
	
	public boolean isFirstSlide(Slide slide){
		if (slide.getOrderNum()==1) {
			return true;
		}
		return false;
	}
}
